<!DOCTYPE html>
<!-- saved from url=(0041)http://c.biancheng.net/view/vip_7061.html -->
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script type="text/javascript" async="" charset="utf-8" src="./7.25Java项目实战：五子棋游戏（附带源码和解析）_files/core.php"></script>

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<!-- 启用Chromium高速渲染模式 -->
<meta name="renderer" content="webkit">
<meta name="force-rendering" content="webkit">
<!-- 禁止百度转码 -->
<meta name="applicable-device" content="pc,mobile">
<meta name="MobileOptimized" content="width">
<meta name="HandheldFriendly" content="true">
<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
<!-- 禁止识别电话号码 -->
<meta name="format-detection" content="telephone=no">

<link rel="shortcut icon" href="http://c.biancheng.net/favicon.ico?v=1.6.72">
<link href="./7.25Java项目实战：五子棋游戏（附带源码和解析）_files/common.css" rel="stylesheet">
<title>Java项目实战：五子棋游戏（附带源码和解析）</title>
<meta name="description" content="本节利用二维数组实现五子棋游戏，希望以此来激发大家的编程热情。除此之外，我们还可以利用二维数组来完成连连看、俄罗斯方块、扫雷等常见小游戏。 首先定义一个二维数组作为">
</head>
<body>
<div id="topbar" class="clearfix">
	<ul id="product-type" class="left">
		<li>
			<a href="http://c.biancheng.net/"><span class="iconfont iconfont-home"></span>首页</a>
		</li>
		<li class="active">
			<a href="http://c.biancheng.net/sitemap/" rel="nofollow"><span class="iconfont iconfont-book"></span>教程</a>
		</li>
		<li>
			<a href="http://vip.biancheng.net/p/vip/show.php" rel="nofollow" target="_blank"><span class="iconfont iconfont-vip"></span>VIP会员</a>
		</li>
		<li>
			<a href="http://vip.biancheng.net/p/q2a/show.php" rel="nofollow" target="_blank"><span class="iconfont iconfont-q2a"></span>一对一答疑</a>
		</li>
		<li>
			<a href="http://fudao.biancheng.net/" rel="nofollow" target="_blank"><span class="iconfont iconfont-fudao"></span>辅导班</a>
		</li>
	</ul>
</div>
<div id="header" class="clearfix">
	<a id="logo" class="left" href="http://c.biancheng.net/">
		<img height="26" src="./7.25Java项目实战：五子棋游戏（附带源码和解析）_files/logo.png" alt="C语言中文网">
	</a>
	<ul id="nav-main" class="hover-none left clearfix">
		<li class="wap-yes"><a href="http://c.biancheng.net/">首页</a></li>
		<li><a href="http://c.biancheng.net/c/">C语言教程</a></li>
		<li><a href="http://c.biancheng.net/cplus/">C++教程</a></li>
		<li><a href="http://c.biancheng.net/python/">Python教程</a></li>
		<li><a href="http://c.biancheng.net/java/">Java教程</a></li>
		<li><a href="http://c.biancheng.net/linux_tutorial/">Linux入门</a></li>
		<li><a href="http://c.biancheng.net/sitemap/" title="网站地图">更多&gt;&gt;</a></li>
	</ul>
	<span id="sidebar-toggle" class="toggle-btn" toggle-target="#sidebar">目录 <span class="glyphicon"></span></span>

	<a href="http://vip.biancheng.net/?from=topbar" class="user-info glyphicon glyphicon-user hover-none" target="_blank" rel="nofollow" title="用户中心"></a>
</div>
<div id="main" class="clearfix">
	<div id="sidebar" class="toggle-target">
	<div id="contents">
		<dt><span class="glyphicon glyphicon-option-vertical" aria-hidden="true"></span><a href="http://c.biancheng.net/java/">Java教程</a></dt>
		
			<dd>
				<span class="channel-num">1</span>
				<a href="http://c.biancheng.net/java/10/">Java入门基础及环境搭建</a>
			</dd>
		
			<dd>
				<span class="channel-num">2</span>
				<a href="http://c.biancheng.net/java/20/">Java程序设计基础</a>
			</dd>
		
			<dd>
				<span class="channel-num">3</span>
				<a href="http://c.biancheng.net/java/30/">Java流程控制语句</a>
			</dd>
		
			<dd>
				<span class="channel-num">4</span>
				<a href="http://c.biancheng.net/java/40/">Java字符串处理</a>
			</dd>
		
			<dd>
				<span class="channel-num">5</span>
				<a href="http://c.biancheng.net/java/50/">Java数字和日期处理</a>
			</dd>
		
			<dd>
				<span class="channel-num">6</span>
				<a href="http://c.biancheng.net/java/60/">Java内置包装类</a>
			</dd>
		<dd class="this"> <span class="channel-num">7</span> <a href="http://c.biancheng.net/java/70/">Java数组处理</a> </dd><dl class="dl-sub"><dd>7.1 <a href="http://c.biancheng.net/view/906.html">Java数组简介</a></dd><dd>7.2 <a href="http://c.biancheng.net/view/5852.html">Java一维数组</a></dd><dd>7.3 <a href="http://c.biancheng.net/view/5857.html">Java二维数组</a></dd><dd>7.4 <a href="http://c.biancheng.net/view/917.html">Java多维数组</a></dd><dd>7.5 <a href="http://c.biancheng.net/view/5863.html">Java不规则数组</a></dd><dd>7.6 <a href="http://c.biancheng.net/view/5843.html">Java数组也是一种数据类型</a></dd><dd>7.7 <a href="http://c.biancheng.net/view/vip_7057.html">Java中到底有没有多维数组（长篇神文）？</a><span class="glyphicon glyphicon-usd"></span></dd><dd>7.8 <a href="http://c.biancheng.net/view/5885.html">Java Arrays工具类</a></dd><dd>7.9 <a href="http://c.biancheng.net/view/vip_7058.html">Java中数组和字符串的相互转换</a><span class="glyphicon glyphicon-usd"></span></dd><dd>7.10 <a href="http://c.biancheng.net/view/919.html">Java比较数组</a></dd><dd>7.11 <a href="http://c.biancheng.net/view/921.html">Java数组填充</a></dd><dd>7.12 <a href="http://c.biancheng.net/view/923.html">Java数组查找指定元素</a></dd><dd>7.13 <a href="http://c.biancheng.net/view/924.html">Java复制数组</a></dd><dd>7.14 <a href="http://c.biancheng.net/view/925.html">Java sort()数组排序</a></dd><dd>7.15 <a href="http://c.biancheng.net/view/927.html">Java冒泡排序法</a></dd><dd>7.16 <a href="http://c.biancheng.net/view/929.html">Java快速排序法</a></dd><dd>7.17 <a href="http://c.biancheng.net/view/930.html">Java选择排序法</a></dd><dd>7.18 <a href="http://c.biancheng.net/view/931.html">Java直接插入排序法</a></dd><dd>7.19 <a href="http://c.biancheng.net/view/5891.html">对Java数组的总结</a></dd><dd>7.20 <a href="http://c.biancheng.net/view/5855.html">Java求数组元素的最大和最小值</a></dd><dd>7.21 <a href="http://c.biancheng.net/view/vip_7059.html">【Java项目实战】数字转人民币读法</a><span class="glyphicon glyphicon-usd"></span></dd><dd>7.22 <a href="http://c.biancheng.net/view/915.html">Java统计商品信息</a></dd><dd>7.23 <a href="http://c.biancheng.net/view/933.html">Java商品信息查询</a></dd><dd>7.24 <a href="http://c.biancheng.net/view/vip_7060.html">【Java项目实战】输出杨辉三角形（使用二维数组）</a><span class="glyphicon glyphicon-usd"></span></dd><dd class="active">7.25 <a href="http://c.biancheng.net/view/vip_7061.html">【Java项目实战】五子棋游戏</a><span class="glyphicon glyphicon-usd"></span></dd></dl>
			<dd>
				<span class="channel-num">8</span>
				<a href="http://c.biancheng.net/java/80/">Java类和对象</a>
			</dd>
		
			<dd>
				<span class="channel-num">9</span>
				<a href="http://c.biancheng.net/java/90/">Java继承和多态</a>
			</dd>
		
			<dd>
				<span class="channel-num">10</span>
				<a href="http://c.biancheng.net/java/100/">Java异常处理</a>
			</dd>
		
			<dd>
				<span class="channel-num">11</span>
				<a href="http://c.biancheng.net/java/110/">Java集合、泛型和枚举</a>
			</dd>
		
			<dd>
				<span class="channel-num">12</span>
				<a href="http://c.biancheng.net/java/120/">Java反射机制</a>
			</dd>
		
			<dd>
				<span class="channel-num">13</span>
				<a href="http://c.biancheng.net/java/130/">Java输入/输出流</a>
			</dd>
		
			<dd>
				<span class="channel-num">14</span>
				<a href="http://c.biancheng.net/java/java/135/">Java注解</a>
			</dd>
		
	</div>
</div>
	<div id="article-wrap">
		<div id="article">
			<div class="arc-info">
	<span class="position"><span class="glyphicon glyphicon-map-marker"></span> <a href="http://c.biancheng.net/">首页</a> &gt; <a href="http://c.biancheng.net/java/">Java教程</a> &gt; <a href="http://c.biancheng.net/java/70/">Java数组处理</a></span>
	<span class="read-num">阅读：4,597</span>
</div>

<div id="ad-position-bottom"></div>
			<h1>Java项目实战：五子棋游戏（附带源码和解析）</h1>
			<div class="pre-next-page clearfix">
                    <span class="pre left"><span class="icon">&lt;</span> <span class="text-brief text-brief-pre">上一页</span><a href="http://c.biancheng.net/view/vip_7060.html">【Java项目实战】输出杨辉三角形（使用二维数组）</a></span>
                    <span class="next right"><a href="http://c.biancheng.net/java/80/">Java类和对象</a><span class="text-brief text-brief-next">下一页</span> <span class="icon">&gt;</span></span>
                </div>
			<div id="ad-arc-top"><p class="pic"></p><p class="text" adid="java-1v1q2a"><a href="http://c.biancheng.net/view/7552.html" target="_blank" style="color: #D33428;">C语言中文网推出辅导班啦，包括<span style="color: #008000;">「C语言辅导班、C++辅导班、算法/数据结构辅导班」</span>，全部都是一对一教学：一对一辅导 + 一对一答疑 + 布置作业 + 项目实践 + 永久学习。QQ在线，随时响应！</a></p></div>
			<div id="arc-body">本节利用二维数组实现五子棋游戏，希望以此来激发大家的编程热情。除此之外，我们还可以利用二维数组来完成连连看、俄罗斯方块、扫雷等常见小游戏。<br>
<br>
首先定义一个二维数组作为下棋的棋盘，每当一个棋手下一步棋后，也就是为二维数组的一个数组元素赋值。下面代码完成了这个程序的初步功能。<br>
<div class="snippet-container" style="undefined;"><div class="sh_bright snippet-wrap"><div class="snippet-menu sh_sourceCode" style="display: none;"><pre><a class="snippet-copy sh_url" href="http://c.biancheng.net/view/vip_7061.html#" style="display: none;">复制</a><a class="snippet-text sh_url" href="http://c.biancheng.net/view/vip_7061.html#">纯文本</a><a class="snippet-window sh_url" href="http://c.biancheng.net/view/vip_7061.html#">复制</a></pre></div><pre class="java sh_java snippet-formatted sh_sourceCode"><ol class="snippet-num"><li><span class="sh_preproc">import</span> java<span class="sh_symbol">.</span>util<span class="sh_symbol">.</span>Scanner<span class="sh_symbol">;</span></li><li><span style="display:none;">&nbsp;</span></li><li><span class="sh_keyword">public</span> <span class="sh_keyword">class</span><span class="sh_normal"> </span><span class="sh_classname">Gobang</span> <span class="sh_cbracket">{</span></li><li>    <span class="sh_comment">// 定义棋盘的大小</span></li><li>    <span class="sh_keyword">public</span> <span class="sh_keyword">static</span> <span class="sh_type">int</span> BOARD_SIZE <span class="sh_symbol">=</span> <span class="sh_number">15</span><span class="sh_symbol">;</span></li><li>    <span class="sh_comment">// 定义一个二维数组来充当棋盘</span></li><li>    <span class="sh_keyword">public</span> <span class="sh_keyword">static</span> String<span class="sh_symbol">[][]</span> board <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> String<span class="sh_symbol">[</span>BOARD_SIZE<span class="sh_symbol">][</span>BOARD_SIZE<span class="sh_symbol">];</span></li><li><span style="display:none;">&nbsp;</span></li><li>    <span class="sh_usertype">String</span><span class="sh_normal"> </span>black <span class="sh_symbol">=</span> <span class="sh_string">"●"</span><span class="sh_symbol">;</span> <span class="sh_comment">// 黑子</span></li><li>    <span class="sh_usertype">String</span><span class="sh_normal"> </span>white <span class="sh_symbol">=</span> <span class="sh_string">"○"</span><span class="sh_symbol">;</span> <span class="sh_comment">// 白子</span></li><li><span style="display:none;">&nbsp;</span></li><li>    <span class="sh_comment">/**</span></li><li><span class="sh_comment">     * 初始化械盘数组</span></li><li><span class="sh_comment">     */</span></li><li>    <span class="sh_keyword">public</span> <span class="sh_type">void</span> <span class="sh_function">initBoard</span><span class="sh_symbol">()</span> <span class="sh_cbracket">{</span></li><li><span style="display:none;">&nbsp;</span></li><li>        <span class="sh_comment">// 把每个元素赋为"╋"，用于在控制台画出棋盘</span></li><li>        <span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_type">int</span> i <span class="sh_symbol">=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span> i <span class="sh_symbol">&lt;</span> BOARD_SIZE<span class="sh_symbol">;</span> i<span class="sh_symbol">++)</span> <span class="sh_cbracket">{</span></li><li>            <span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_type">int</span> j <span class="sh_symbol">=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span> j <span class="sh_symbol">&lt;</span> BOARD_SIZE<span class="sh_symbol">;</span> j<span class="sh_symbol">++)</span> <span class="sh_cbracket">{</span></li><li>                board<span class="sh_symbol">[</span>i<span class="sh_symbol">][</span>j<span class="sh_symbol">]</span> <span class="sh_symbol">=</span> <span class="sh_string">"╋"</span><span class="sh_symbol">;</span></li><li>            <span class="sh_cbracket">}</span></li><li>        <span class="sh_cbracket">}</span></li><li>    <span class="sh_cbracket">}</span></li><li><span style="display:none;">&nbsp;</span></li><li>    <span class="sh_comment">/**</span></li><li><span class="sh_comment">     * 在控制台输出棋盘的方法</span></li><li><span class="sh_comment">     */</span></li><li>    <span class="sh_keyword">public</span> <span class="sh_type">void</span> <span class="sh_function">printBoard</span><span class="sh_symbol">()</span> <span class="sh_cbracket">{</span></li><li>        <span class="sh_comment">// 打印毎个数组元素</span></li><li>        <span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_type">int</span> i <span class="sh_symbol">=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span> i <span class="sh_symbol">&lt;</span> BOARD_SIZE<span class="sh_symbol">;</span> i<span class="sh_symbol">++)</span> <span class="sh_cbracket">{</span></li><li>            <span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_type">int</span> j <span class="sh_symbol">=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span> j <span class="sh_symbol">&lt;</span> BOARD_SIZE<span class="sh_symbol">;</span> j<span class="sh_symbol">++)</span> <span class="sh_cbracket">{</span></li><li>                <span class="sh_comment">// 打印数组元素后不换行</span></li><li>                System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">print</span><span class="sh_symbol">(</span>board<span class="sh_symbol">[</span>i<span class="sh_symbol">][</span>j<span class="sh_symbol">]);</span></li><li>            <span class="sh_cbracket">}</span></li><li>            <span class="sh_comment">// 毎打印完一行数组元素后输出一个换行符</span></li><li>            System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">print</span><span class="sh_symbol">(</span><span class="sh_string">"</span><span class="sh_specialchar">\n</span><span class="sh_string">"</span><span class="sh_symbol">);</span></li><li>        <span class="sh_cbracket">}</span></li><li>    <span class="sh_cbracket">}</span></li><li><span style="display:none;">&nbsp;</span></li><li>    <span class="sh_comment">/**</span></li><li><span class="sh_comment">     * 判断输赢的方法</span></li><li><span class="sh_comment">     */</span></li><li>    <span class="sh_keyword">public</span> <span class="sh_keyword">static</span> <span class="sh_type">boolean</span> <span class="sh_function">isWin</span><span class="sh_symbol">(</span><span class="sh_type">int</span> x<span class="sh_symbol">,</span> <span class="sh_type">int</span> y<span class="sh_symbol">,</span> <span class="sh_usertype">String</span><span class="sh_normal"> </span>color<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span></li><li>        <span class="sh_keyword">if</span> <span class="sh_symbol">(</span>color<span class="sh_symbol">.</span><span class="sh_function">equals</span><span class="sh_symbol">(</span><span class="sh_string">"black"</span><span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>            color <span class="sh_symbol">=</span> <span class="sh_string">"●"</span><span class="sh_symbol">;</span></li><li>        <span class="sh_cbracket">}</span></li><li>        <span class="sh_keyword">if</span> <span class="sh_symbol">(</span>color<span class="sh_symbol">.</span><span class="sh_function">equals</span><span class="sh_symbol">(</span><span class="sh_string">"white"</span><span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>            color <span class="sh_symbol">=</span> <span class="sh_string">"○"</span><span class="sh_symbol">;</span></li><li>        <span class="sh_cbracket">}</span></li><li>        <span class="sh_comment">// 横向</span></li><li>        <span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_type">int</span> i <span class="sh_symbol">=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span> i <span class="sh_symbol">&lt;</span> board<span class="sh_symbol">.</span>length <span class="sh_symbol">-</span> <span class="sh_number">5</span><span class="sh_symbol">;</span> i<span class="sh_symbol">++)</span> <span class="sh_cbracket">{</span></li><li>            <span class="sh_keyword">if</span> <span class="sh_symbol">(</span>board<span class="sh_symbol">[</span>x<span class="sh_symbol">][</span>i<span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span>color<span class="sh_symbol">)</span> <span class="sh_symbol">&amp;&amp;</span> board<span class="sh_symbol">[</span>x<span class="sh_symbol">][</span>i <span class="sh_symbol">+</span> <span class="sh_number">1</span><span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span>color<span class="sh_symbol">)</span> <span class="sh_symbol">&amp;&amp;</span> board<span class="sh_symbol">[</span>x<span class="sh_symbol">][</span>i <span class="sh_symbol">+</span> <span class="sh_number">2</span><span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span>color<span class="sh_symbol">)</span></li><li>                    <span class="sh_symbol">&amp;&amp;</span> board<span class="sh_symbol">[</span>x<span class="sh_symbol">][</span>i <span class="sh_symbol">+</span> <span class="sh_number">3</span><span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span>color<span class="sh_symbol">)</span> <span class="sh_symbol">&amp;&amp;</span> board<span class="sh_symbol">[</span>x<span class="sh_symbol">][</span>i <span class="sh_symbol">+</span> <span class="sh_number">4</span><span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span>color<span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>                <span class="sh_keyword">return</span> <span class="sh_keyword">true</span><span class="sh_symbol">;</span></li><li>            <span class="sh_cbracket">}</span></li><li>        <span class="sh_cbracket">}</span></li><li>        <span class="sh_comment">// 竖向</span></li><li>        <span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_type">int</span> i <span class="sh_symbol">=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span> i <span class="sh_symbol">&lt;</span> board<span class="sh_symbol">.</span>length <span class="sh_symbol">-</span> <span class="sh_number">5</span><span class="sh_symbol">;</span> i<span class="sh_symbol">++)</span> <span class="sh_cbracket">{</span></li><li>            <span class="sh_keyword">if</span> <span class="sh_symbol">(</span>board<span class="sh_symbol">[</span>i<span class="sh_symbol">][</span>y<span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span>color<span class="sh_symbol">)</span> <span class="sh_symbol">&amp;&amp;</span> board<span class="sh_symbol">[</span>i <span class="sh_symbol">+</span> <span class="sh_number">1</span><span class="sh_symbol">][</span>y<span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span>color<span class="sh_symbol">)</span> <span class="sh_symbol">&amp;&amp;</span> board<span class="sh_symbol">[</span>i <span class="sh_symbol">+</span> <span class="sh_number">2</span><span class="sh_symbol">][</span>y<span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span>color<span class="sh_symbol">)</span></li><li>                    <span class="sh_symbol">&amp;&amp;</span> board<span class="sh_symbol">[</span>i <span class="sh_symbol">+</span> <span class="sh_number">3</span><span class="sh_symbol">][</span>y<span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span>color<span class="sh_symbol">)</span> <span class="sh_symbol">&amp;&amp;</span> board<span class="sh_symbol">[</span>i <span class="sh_symbol">+</span> <span class="sh_number">4</span><span class="sh_symbol">][</span>y<span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span>color<span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>                <span class="sh_keyword">return</span> <span class="sh_keyword">true</span><span class="sh_symbol">;</span></li><li>            <span class="sh_cbracket">}</span></li><li>        <span class="sh_cbracket">}</span></li><li>        <span class="sh_keyword">return</span> <span class="sh_keyword">false</span><span class="sh_symbol">;</span></li><li>    <span class="sh_cbracket">}</span></li><li><span style="display:none;">&nbsp;</span></li><li>    <span class="sh_comment">/**</span></li><li><span class="sh_comment">     * 判断指定坐标是否有棋子</span></li><li><span class="sh_comment">     */</span></li><li>    <span class="sh_keyword">public</span> <span class="sh_keyword">static</span> <span class="sh_type">boolean</span> <span class="sh_function">isOk</span><span class="sh_symbol">(</span><span class="sh_type">int</span> x<span class="sh_symbol">,</span> <span class="sh_type">int</span> y<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span></li><li>        <span class="sh_keyword">if</span> <span class="sh_symbol">(!</span>board<span class="sh_symbol">[</span>x <span class="sh_symbol">-</span> <span class="sh_number">1</span><span class="sh_symbol">][</span>y <span class="sh_symbol">-</span> <span class="sh_number">1</span><span class="sh_symbol">].</span><span class="sh_function">equals</span><span class="sh_symbol">(</span><span class="sh_string">"╋"</span><span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>            <span class="sh_keyword">return</span> <span class="sh_keyword">false</span><span class="sh_symbol">;</span></li><li>        <span class="sh_cbracket">}</span></li><li>        <span class="sh_keyword">return</span> <span class="sh_keyword">true</span><span class="sh_symbol">;</span></li><li>    <span class="sh_cbracket">}</span></li><li><span style="display:none;">&nbsp;</span></li><li>    <span class="sh_comment">/**</span></li><li><span class="sh_comment">     * 电脑下棋</span></li><li><span class="sh_comment">     */</span></li><li>    <span class="sh_keyword">public</span> <span class="sh_keyword">static</span> <span class="sh_usertype">String</span><span class="sh_normal"> </span><span class="sh_function">computer</span><span class="sh_symbol">(</span><span class="sh_usertype">String</span><span class="sh_normal"> </span>color<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span></li><li><span style="display:none;">&nbsp;</span></li><li>        <span class="sh_type">int</span> x <span class="sh_symbol">=</span> <span class="sh_symbol">(</span><span class="sh_type">int</span><span class="sh_symbol">)</span> <span class="sh_symbol">(</span>Math<span class="sh_symbol">.</span><span class="sh_function">random</span><span class="sh_symbol">()</span> <span class="sh_symbol">*</span> <span class="sh_number">14</span><span class="sh_symbol">)</span> <span class="sh_symbol">+</span> <span class="sh_number">1</span><span class="sh_symbol">;</span> <span class="sh_comment">// 生成一个1~14之间的随机数</span></li><li>        <span class="sh_type">int</span> y <span class="sh_symbol">=</span> <span class="sh_symbol">(</span><span class="sh_type">int</span><span class="sh_symbol">)</span> <span class="sh_symbol">(</span>Math<span class="sh_symbol">.</span><span class="sh_function">random</span><span class="sh_symbol">()</span> <span class="sh_symbol">*</span> <span class="sh_number">14</span><span class="sh_symbol">)</span> <span class="sh_symbol">+</span> <span class="sh_number">1</span><span class="sh_symbol">;</span> <span class="sh_comment">// 生成一个1~14之间的随机数</span></li><li>        <span class="sh_comment">// 判断电脑下棋的坐标有无棋子，有棋子则在重新生成随机数</span></li><li>        <span class="sh_keyword">if</span> <span class="sh_symbol">(</span><span class="sh_function">isOk</span><span class="sh_symbol">(</span>x<span class="sh_symbol">,</span> y<span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>            <span class="sh_keyword">if</span> <span class="sh_symbol">(</span>color<span class="sh_symbol">.</span><span class="sh_function">equals</span><span class="sh_symbol">(</span><span class="sh_string">"black"</span><span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>                board<span class="sh_symbol">[</span>x<span class="sh_symbol">][</span>y<span class="sh_symbol">]</span> <span class="sh_symbol">=</span> <span class="sh_string">"●"</span><span class="sh_symbol">;</span></li><li>            <span class="sh_cbracket">}</span> <span class="sh_keyword">else</span> <span class="sh_keyword">if</span> <span class="sh_symbol">(</span>color<span class="sh_symbol">.</span><span class="sh_function">equals</span><span class="sh_symbol">(</span><span class="sh_string">"white"</span><span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>                board<span class="sh_symbol">[</span>x<span class="sh_symbol">][</span>y<span class="sh_symbol">]</span> <span class="sh_symbol">=</span> <span class="sh_string">"○"</span><span class="sh_symbol">;</span></li><li>            <span class="sh_cbracket">}</span></li><li>        <span class="sh_cbracket">}</span> <span class="sh_keyword">else</span> <span class="sh_cbracket">{</span></li><li>            <span class="sh_function">computer</span><span class="sh_symbol">(</span>color<span class="sh_symbol">);</span></li><li>        <span class="sh_cbracket">}</span></li><li>        <span class="sh_keyword">return</span> <span class="sh_string">"x,y"</span><span class="sh_symbol">;</span></li><li>    <span class="sh_cbracket">}</span></li><li><span style="display:none;">&nbsp;</span></li><li>    <span class="sh_keyword">public</span> <span class="sh_keyword">static</span> <span class="sh_type">void</span> <span class="sh_function">main</span><span class="sh_symbol">(</span>String<span class="sh_symbol">[]</span> args<span class="sh_symbol">)</span> <span class="sh_keyword">throws</span> Exception <span class="sh_cbracket">{</span></li><li>        <span class="sh_usertype">Gobang</span><span class="sh_normal"> </span>gb <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_function">Gobang</span><span class="sh_symbol">();</span></li><li>        gb<span class="sh_symbol">.</span><span class="sh_function">initBoard</span><span class="sh_symbol">();</span></li><li>        gb<span class="sh_symbol">.</span><span class="sh_function">printBoard</span><span class="sh_symbol">();</span></li><li>        <span class="sh_comment">// 这是用于获取键盘输入的方法</span></li><li>        <span class="sh_usertype">Scanner</span><span class="sh_normal"> </span>input <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_function">Scanner</span><span class="sh_symbol">(</span>System<span class="sh_symbol">.</span>in<span class="sh_symbol">);</span> <span class="sh_comment">// 使用Scanner类获取用户输入</span></li><li>        System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">println</span><span class="sh_symbol">(</span><span class="sh_string">"您想要选择什么颜色的棋，black或white，请输入："</span><span class="sh_symbol">);</span></li><li>        <span class="sh_usertype">String</span><span class="sh_normal"> </span>peopleColor <span class="sh_symbol">=</span> input<span class="sh_symbol">.</span><span class="sh_function">next</span><span class="sh_symbol">();</span> <span class="sh_comment">// 定义用户选择棋子的颜色并返回用户输入的字符串</span></li><li>        <span class="sh_comment">// 如果用户选择的是白棋，则电脑先下（五子棋中黑棋先下）</span></li><li>        <span class="sh_keyword">if</span> <span class="sh_symbol">(</span>peopleColor<span class="sh_symbol">.</span><span class="sh_function">equals</span><span class="sh_symbol">(</span><span class="sh_string">"white"</span><span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>            System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">println</span><span class="sh_symbol">(</span><span class="sh_string">"您选择的是白棋"</span><span class="sh_symbol">);</span></li><li>            <span class="sh_function">computer</span><span class="sh_symbol">(</span><span class="sh_string">"black"</span><span class="sh_symbol">);</span></li><li>            gb<span class="sh_symbol">.</span><span class="sh_function">printBoard</span><span class="sh_symbol">();</span></li><li>        <span class="sh_cbracket">}</span></li><li>        <span class="sh_usertype">String</span><span class="sh_normal"> </span>inputStr<span class="sh_symbol">;</span></li><li>        <span class="sh_keyword">do</span> <span class="sh_cbracket">{</span></li><li>            System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">println</span><span class="sh_symbol">(</span><span class="sh_string">"输入您下棋的坐标，应以x,y的格式："</span><span class="sh_symbol">);</span></li><li>            inputStr <span class="sh_symbol">=</span> input<span class="sh_symbol">.</span><span class="sh_function">next</span><span class="sh_symbol">();</span></li><li>            <span class="sh_comment">// 定义数组并赋值坐标x，,y</span></li><li>            String<span class="sh_symbol">[]</span> posStrArr <span class="sh_symbol">=</span> inputStr<span class="sh_symbol">.</span><span class="sh_function">split</span><span class="sh_symbol">(</span><span class="sh_string">","</span><span class="sh_symbol">);</span></li><li>            <span class="sh_type">int</span> x <span class="sh_symbol">=</span> Integer<span class="sh_symbol">.</span><span class="sh_function">parseInt</span><span class="sh_symbol">(</span>posStrArr<span class="sh_symbol">[</span><span class="sh_number">0</span><span class="sh_symbol">]);</span></li><li>            <span class="sh_type">int</span> y <span class="sh_symbol">=</span> Integer<span class="sh_symbol">.</span><span class="sh_function">parseInt</span><span class="sh_symbol">(</span>posStrArr<span class="sh_symbol">[</span><span class="sh_number">1</span><span class="sh_symbol">]);</span></li><li>            <span class="sh_comment">// 如果输入坐标已有棋子，则重新输入坐标</span></li><li>            <span class="sh_keyword">if</span> <span class="sh_symbol">(!</span><span class="sh_function">isOk</span><span class="sh_symbol">(</span>x<span class="sh_symbol">,</span> y<span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>                System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">println</span><span class="sh_symbol">(</span><span class="sh_string">"此处已有棋子，请换位置！"</span><span class="sh_symbol">);</span></li><li>                <span class="sh_keyword">continue</span><span class="sh_symbol">;</span></li><li>            <span class="sh_cbracket">}</span></li><li>            <span class="sh_comment">// 将上面分隔完以后的字符串转换成用户下棋的坐标</span></li><li>            <span class="sh_type">int</span> xPos <span class="sh_symbol">=</span> x<span class="sh_symbol">;</span></li><li>            <span class="sh_type">int</span> yPos <span class="sh_symbol">=</span> y<span class="sh_symbol">;</span></li><li><span style="display:none;">&nbsp;</span></li><li>            <span class="sh_comment">// 定义电脑棋子颜色</span></li><li>            <span class="sh_usertype">String</span><span class="sh_normal"> </span>comColor <span class="sh_symbol">=</span> <span class="sh_keyword">null</span><span class="sh_symbol">;</span></li><li>            <span class="sh_comment">// 根据用户选择的棋子颜色给对应的数组元素赋值</span></li><li>            <span class="sh_keyword">if</span> <span class="sh_symbol">(</span>peopleColor<span class="sh_symbol">.</span><span class="sh_function">equals</span><span class="sh_symbol">(</span><span class="sh_string">"black"</span><span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>                gb<span class="sh_symbol">.</span>board<span class="sh_symbol">[</span>xPos <span class="sh_symbol">-</span> <span class="sh_number">1</span><span class="sh_symbol">][</span>yPos <span class="sh_symbol">-</span> <span class="sh_number">1</span><span class="sh_symbol">]</span> <span class="sh_symbol">=</span> <span class="sh_string">"●"</span><span class="sh_symbol">;</span></li><li>                comColor <span class="sh_symbol">=</span> <span class="sh_string">"white"</span><span class="sh_symbol">;</span></li><li>            <span class="sh_cbracket">}</span> <span class="sh_keyword">else</span> <span class="sh_keyword">if</span> <span class="sh_symbol">(</span>peopleColor<span class="sh_symbol">.</span><span class="sh_function">equals</span><span class="sh_symbol">(</span><span class="sh_string">"white"</span><span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>                gb<span class="sh_symbol">.</span>board<span class="sh_symbol">[</span>xPos <span class="sh_symbol">-</span> <span class="sh_number">1</span><span class="sh_symbol">][</span>yPos <span class="sh_symbol">-</span> <span class="sh_number">1</span><span class="sh_symbol">]</span> <span class="sh_symbol">=</span> <span class="sh_string">"○"</span><span class="sh_symbol">;</span></li><li>                comColor <span class="sh_symbol">=</span> <span class="sh_string">"black"</span><span class="sh_symbol">;</span></li><li>            <span class="sh_cbracket">}</span></li><li>            <span class="sh_function">computer</span><span class="sh_symbol">(</span>comColor<span class="sh_symbol">);</span></li><li>            gb<span class="sh_symbol">.</span><span class="sh_function">printBoard</span><span class="sh_symbol">();</span></li><li>            <span class="sh_comment">// 判断输赢</span></li><li>            <span class="sh_keyword">if</span> <span class="sh_symbol">(</span><span class="sh_function">isWin</span><span class="sh_symbol">(</span>xPos <span class="sh_symbol">-</span> <span class="sh_number">1</span><span class="sh_symbol">,</span> yPos <span class="sh_symbol">-</span> <span class="sh_number">1</span><span class="sh_symbol">,</span> peopleColor<span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>                System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">println</span><span class="sh_symbol">(</span>peopleColor <span class="sh_symbol">+</span> <span class="sh_string">"获胜！"</span><span class="sh_symbol">);</span></li><li>                <span class="sh_keyword">break</span><span class="sh_symbol">;</span></li><li>            <span class="sh_cbracket">}</span></li><li>            <span class="sh_keyword">if</span> <span class="sh_symbol">(</span><span class="sh_function">isWin</span><span class="sh_symbol">(</span>xPos <span class="sh_symbol">-</span> <span class="sh_number">1</span><span class="sh_symbol">,</span> yPos <span class="sh_symbol">-</span> <span class="sh_number">1</span><span class="sh_symbol">,</span> comColor<span class="sh_symbol">))</span> <span class="sh_cbracket">{</span></li><li>                System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">println</span><span class="sh_symbol">(</span>comColor <span class="sh_symbol">+</span> <span class="sh_string">"获胜！"</span><span class="sh_symbol">);</span></li><li>                <span class="sh_keyword">break</span><span class="sh_symbol">;</span></li><li>            <span class="sh_cbracket">}</span></li><li>        <span class="sh_cbracket">}</span> <span class="sh_keyword">while</span> <span class="sh_symbol">(</span>inputStr <span class="sh_symbol">!=</span> <span class="sh_keyword">null</span><span class="sh_symbol">);</span></li><li>    <span class="sh_cbracket">}</span></li><li><span class="sh_cbracket">}</span></li></ol></pre><pre class="snippet-textonly sh_sourceCode" style="display:none;">import java.util.Scanner;

public class Gobang {
    // 定义棋盘的大小
    public static int BOARD_SIZE = 15;
    // 定义一个二维数组来充当棋盘
    public static String[][] board = new String[BOARD_SIZE][BOARD_SIZE];

    String black = "●"; // 黑子
    String white = "○"; // 白子

    /**
     * 初始化械盘数组
     */
    public void initBoard() {

        // 把每个元素赋为"╋"，用于在控制台画出棋盘
        for (int i = 0; i &lt; BOARD_SIZE; i++) {
            for (int j = 0; j &lt; BOARD_SIZE; j++) {
                board[i][j] = "╋";
            }
        }
    }

    /**
     * 在控制台输出棋盘的方法
     */
    public void printBoard() {
        // 打印毎个数组元素
        for (int i = 0; i &lt; BOARD_SIZE; i++) {
            for (int j = 0; j &lt; BOARD_SIZE; j++) {
                // 打印数组元素后不换行
                System.out.print(board[i][j]);
            }
            // 毎打印完一行数组元素后输出一个换行符
            System.out.print("\n");
        }
    }

    /**
     * 判断输赢的方法
     */
    public static boolean isWin(int x, int y, String color) {
        if (color.equals("black")) {
            color = "●";
        }
        if (color.equals("white")) {
            color = "○";
        }
        // 横向
        for (int i = 0; i &lt; board.length - 5; i++) {
            if (board[x][i].equals(color) &amp;&amp; board[x][i + 1].equals(color) &amp;&amp; board[x][i + 2].equals(color)
                    &amp;&amp; board[x][i + 3].equals(color) &amp;&amp; board[x][i + 4].equals(color)) {
                return true;
            }
        }
        // 竖向
        for (int i = 0; i &lt; board.length - 5; i++) {
            if (board[i][y].equals(color) &amp;&amp; board[i + 1][y].equals(color) &amp;&amp; board[i + 2][y].equals(color)
                    &amp;&amp; board[i + 3][y].equals(color) &amp;&amp; board[i + 4][y].equals(color)) {
                return true;
            }
        }
        return false;
    }

    /**
     * 判断指定坐标是否有棋子
     */
    public static boolean isOk(int x, int y) {
        if (!board[x - 1][y - 1].equals("╋")) {
            return false;
        }
        return true;
    }

    /**
     * 电脑下棋
     */
    public static String computer(String color) {

        int x = (int) (Math.random() * 14) + 1; // 生成一个1~14之间的随机数
        int y = (int) (Math.random() * 14) + 1; // 生成一个1~14之间的随机数
        // 判断电脑下棋的坐标有无棋子，有棋子则在重新生成随机数
        if (isOk(x, y)) {
            if (color.equals("black")) {
                board[x][y] = "●";
            } else if (color.equals("white")) {
                board[x][y] = "○";
            }
        } else {
            computer(color);
        }
        return "x,y";
    }

    public static void main(String[] args) throws Exception {
        Gobang gb = new Gobang();
        gb.initBoard();
        gb.printBoard();
        // 这是用于获取键盘输入的方法
        Scanner input = new Scanner(System.in); // 使用Scanner类获取用户输入
        System.out.println("您想要选择什么颜色的棋，black或white，请输入：");
        String peopleColor = input.next(); // 定义用户选择棋子的颜色并返回用户输入的字符串
        // 如果用户选择的是白棋，则电脑先下（五子棋中黑棋先下）
        if (peopleColor.equals("white")) {
            System.out.println("您选择的是白棋");
            computer("black");
            gb.printBoard();
        }
        String inputStr;
        do {
            System.out.println("输入您下棋的坐标，应以x,y的格式：");
            inputStr = input.next();
            // 定义数组并赋值坐标x，,y
            String[] posStrArr = inputStr.split(",");
            int x = Integer.parseInt(posStrArr[0]);
            int y = Integer.parseInt(posStrArr[1]);
            // 如果输入坐标已有棋子，则重新输入坐标
            if (!isOk(x, y)) {
                System.out.println("此处已有棋子，请换位置！");
                continue;
            }
            // 将上面分隔完以后的字符串转换成用户下棋的坐标
            int xPos = x;
            int yPos = y;

            // 定义电脑棋子颜色
            String comColor = null;
            // 根据用户选择的棋子颜色给对应的数组元素赋值
            if (peopleColor.equals("black")) {
                gb.board[xPos - 1][yPos - 1] = "●";
                comColor = "white";
            } else if (peopleColor.equals("white")) {
                gb.board[xPos - 1][yPos - 1] = "○";
                comColor = "black";
            }
            computer(comColor);
            gb.printBoard();
            // 判断输赢
            if (isWin(xPos - 1, yPos - 1, peopleColor)) {
                System.out.println(peopleColor + "获胜！");
                break;
            }
            if (isWin(xPos - 1, yPos - 1, comColor)) {
                System.out.println(comColor + "获胜！");
                break;
            }
        } while (inputStr != null);
    }
}</pre></div></div>
运行上面程序，可以看到如图 1 所示的界面。<br>
<br>
<div style="text-align: center;">
	<img alt="五子棋的运行界面" src="./7.25Java项目实战：五子棋游戏（附带源码和解析）_files/5-19101110592C10.png"><br>
	图 1&nbsp;&nbsp;五子棋的运行界面</div>
<br>
从图 1 来看，程序上显示的黑点是棋手下的棋，而白棋是电脑下的棋。本节我们使用随机生成两个坐标值来控制电脑下棋，当然也可以添加人工智能（但这已经超出了本教程的范围）来控制下棋。<br>
<br>
上面程序涉及读取用户键盘输入，在这里了解即可，教程后面会详细讲解。除此之外，程序中的 main 方法还包含了 throws Exception 声明，表明该程序的 main 方法不处理任何异常。教程第10 章才会介绍异常处理的知识，所以此处不处理任何异常。<br>
<br>
除此之外，本节只判断了横、竖是否有5个棋连在一起，从而判定胜负，读者可以继续在这个基础上进行完善。</div>
			<div id="arc-append">
	<p>关注微信公众号「站长严长生」，在手机上阅读所有教程，随时随地都能学习。本公众号由<a class="col-link" href="http://c.biancheng.net/view/8092.html" target="_blank" rel="nofollow">C语言中文网站长</a>运营，每日更新，坚持原创，敢说真话，凡事有态度。</p>
	<p style="margin-top:12px; text-align:center;">
		<img width="180" src="./7.25Java项目实战：五子棋游戏（附带源码和解析）_files/qrcode_weixueyuan_original.png" alt="魏雪原二维码"><br>
		<span class="col-green">微信扫描二维码关注公众号</span>
	</p>
</div>
<!-- <p>关注微信公众号「魏雪原」，跟着<a class="col-link" href="/view/8092.html" target="_blank">站长</a>一起学习，拒绝躺平，跳出内卷，用知识完成阶级跃升：</p>
	<ul>
		<li>每日更新，坚持原创，敢说真话，凡事有态度。</li>
		<li>编程+求职+创业+营销，既有硬知识，也有软技能。</li>
		<li>手机端阅读教程，随时随地都能学习。</li>
		<li>即将绑定网站部分功能，包括注册登录、找回密码、获取下载链接等。</li>
	</ul> -->
			<div class="pre-next-page clearfix">
                    <span class="pre left"><span class="icon">&lt;</span> <span class="text-brief text-brief-pre">上一页</span><a href="http://c.biancheng.net/view/vip_7060.html">【Java项目实战】输出杨辉三角形（使用二维数组）</a></span>
                    <span class="next right"><a href="http://c.biancheng.net/java/80/">Java类和对象</a><span class="text-brief text-brief-next">下一页</span> <span class="icon">&gt;</span></span>
                </div>
			<div id="ad-arc-bottom"></div>

<!-- <div id="ad-bottom-weixin" class="clearfix">
	<div class="left" style="width: 535px;">
		<p><span class="col-red">编程帮</span>，一个分享编程知识的公众号。跟着<a class="col-link" href="/cpp/about/author/" target="_blank">站长</a>一起学习，每天都有进步。</p>
		<p>通俗易懂，深入浅出，一篇文章只讲一个知识点。</p>
		<p>文章不深奥，不需要钻研，在公交、在地铁、在厕所都可以阅读，随时随地涨姿势。</p>
		<p>文章不涉及代码，不烧脑细胞，人人都可以学习。</p>
		<p>当你决定关注「编程帮」，你已然超越了90%的程序员！</p>
	</div>
	<div class="right" style="width: 150px;">
		<img width="150" src="/templets/new/images/erweima_biancheng.gif?v=1.6.72" alt="编程帮二维码" /><br />
		<span class="col-green">微信扫描二维码关注</span>
	</div>
</div> -->

<div id="nice-arcs" class="box-bottom">
	<h4>优秀文章</h4>
	<ul class="clearfix">
<li><a href="http://c.biancheng.net/view/1043.html" title="Java异常处理机制及异常处理的基本结构">Java异常处理机制及异常处理的基本结构</a></li>
<li><a href="http://c.biancheng.net/view/1096.html" title="Linux rsyslogd服务及启动方法（详解版）">Linux rsyslogd服务及启动方法（详解版）</a></li>
<li><a href="http://c.biancheng.net/view/1520.html" title="Servlet是什么？">Servlet是什么？</a></li>
<li><a href="http://c.biancheng.net/view/1632.html" title="DOM4j解析XML">DOM4j解析XML</a></li>
<li><a href="http://c.biancheng.net/view/1779.html" title="同飞教育Java SE入门视频教程（付强主讲）">同飞教育Java SE入门视频教程（付强主讲）</a></li>
<li><a href="http://c.biancheng.net/view/vip_3312.html" title="黑马程序员Linux运维工作场景解决方案零基础到就业">黑马程序员Linux运维工作场景解决方案零基础到就业</a></li>
<li><a href="http://c.biancheng.net/view/3511.html" title="汇编语言加法和减法详解">汇编语言加法和减法详解</a></li>
<li><a href="http://c.biancheng.net/view/4309.html" title="第一个MyBatis程序">第一个MyBatis程序</a></li>
<li><a href="http://c.biancheng.net/view/5714.html" title="Go语言Context（上下文）">Go语言Context（上下文）</a></li>
<li><a href="http://c.biancheng.net/ml_alg/linear-regression.html" title="线性回归算法详解">线性回归算法详解</a></li>
</ul>
</div>
		</div>
		
	</div>
</div>
<script type="text/javascript">
// 当前文章ID
window.arcIdRaw = 'a_' + 7061;
window.arcId = "1102rf3bOx+/iO/oqTgxDuggv4hVuj5697M+nifq8+UoKSBzQpoSJzgO+bA";
window.typeidChain = "98|79";
</script>
<div id="footer" class="clearfix">
	<div class="info left">
	<p>精美而实用的网站，分享优质编程教程，帮助有志青年。千锤百炼，只为大作；精益求精，处处斟酌；这种教程，看一眼就倾心。</p>
	<p>
		<a href="http://c.biancheng.net/view/8066.html" target="_blank" rel="nofollow">关于网站</a> <span>|</span>
		<a href="http://c.biancheng.net/view/8092.html" target="_blank" rel="nofollow">关于站长</a> <span>|</span>
		<a href="http://c.biancheng.net/view/8097.html" target="_blank" rel="nofollow">如何完成一部教程</a> <span>|</span>
		<a href="http://c.biancheng.net/view/8093.html" target="_blank" rel="nofollow">联系我们</a> <span>|</span>
		<a href="http://c.biancheng.net/sitemap/" target="_blank" rel="nofollow">网站地图</a>
	</p>
	<p>Copyright ©2012-2021 biancheng.net, <a href="http://www.beian.miit.gov.cn/" target="_blank" rel="nofollow" style="color:#666;">陕ICP备15000209号</a></p>
	</div>
	<img class="right" src="./7.25Java项目实战：五子棋游戏（附带源码和解析）_files/logo_bottom.gif" alt="底部Logo">
	<span id="return-top"><b>↑</b></span>
</div>

<script type="text/javascript">
window.siteId = 4;
window.cmsTemplets = "/templets/new";
window.cmsTempletsVer = "1.6.72";
</script>

<script src="./7.25Java项目实战：五子棋游戏（附带源码和解析）_files/jquery1.12.4.min.js.下载"></script>
<script src="./7.25Java项目实战：五子棋游戏（附带源码和解析）_files/common.js.下载"></script>
<span style="display:none;"><script src="./7.25Java项目实战：五子棋游戏（附带源码和解析）_files/z_stat.php" type="text/javascript" defer="defer" async="async"></script></span>

</body></html>